package behavior.strategy.versionThree;

import lombok.extern.slf4j.Slf4j;

import java.math.BigDecimal;
import java.util.Scanner;

/**
 * @author huhaiqiang
 * @version V1.0
 * @description 商场收银系统2.0
 * @date 2018/12/03 15:19
 */
@Slf4j
public class market {

    private static BigDecimal total = new BigDecimal("0.0");

    public static void main(String[] args) {

        Scanner scan = new Scanner(System.in);
        System.out.println("请输入活动类型：1、正常收费  2、满300减100  3、打八折");
        int type = scan.nextInt();
        System.out.print("请输入单价：");
        String goodsPrice = scan.next();
        System.out.print("请输入数量：");
        String goodsNum = scan.next();

        CashContext cashContext = new CashContext(type);
        BigDecimal totalPrice = cashContext.getResult(new BigDecimal(goodsPrice)).multiply(new BigDecimal(goodsNum));

        total = total.add(totalPrice);
        log.info("===============================");
        log.info("单价：" + goodsPrice + "  数量：" + goodsNum + "  合计：" + total);
        log.info("===============================");

    }

}
